import java.util.Arrays;
import java.util.Stack;

public class ZuoYe {

    public static void main1(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        System.out.println(stack.pop());//弹出栈顶元素，并且删除 4
        System.out.println(stack.peek());//获取栈顶元素，但是不删除 3
        System.out.println(stack.peek());//获取栈顶元素，但是不删除 3
        System.out.println(stack.empty());
        System.out.println("============");
        System.out.println(stack.isEmpty());
    }

    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        stack.push(5);

    }
    public static void shell(int[] array,int gap){
        for (int i = gap; i < array.length; i++) {
            int j = i-gap;
            int tmp = array[i];
            for (; j >= 0; j-=gap) {
                if (tmp < array[j]){
                    array[j+gap] = array[j];
                }else {
                    break;
                }
            }
            array[j+gap] = tmp;
        }

    }
    public static void shellSort1(int[] array){
        int gap = array.length;
        while (gap > 1){
            shell(array,gap);
            gap /= 5;
        }
        shell(array,1);


    }
    public static void shellSort(int[] array){
        int[] dic = {5};
        for (int i = 0; i < dic.length; i++) {
            shell(array,dic[i]);
        }


    }

    public static void main2(String[] args) {
        int[] array = {10,20,8,25,35,6,18,30,5,15,28};
        shellSort(array);
        System.out.println(Arrays.toString(array));

    }
}
